﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <title th:text="加好友"></title>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="WAP游戏,文字游戏,怀旧,mud">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telphone=no,email=no">
    <meta name="misapplication-tap-highlight" content="no">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/modules/mojie/mojie.css}" />
    　<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
</head>
<p th:text="${is}"></p>
<p id="friendId"  style="display: none"><span th:text="${friendId}"></span></p>
<br/>
<div th:if="${role!=null}">
    <input id="input" type="text" placeholder="请输入申请好友原因"/>
    <br/><input type="button" id="btn" value="申请"/>
</div>
<nav class="page-navigate-bar">
    <a th:href="@{game(cmd=scene)}" title="">返回游戏</a>
</nav>
</body>
</html>
<script>
    $("#btn").click(function () {
        var input = $("#input").val();
        var friendId = $("#friendId").text();
        $.ajax({
            type : 'post',
            async : false,
            url : 'addFriend',
            data : {
                "input" : input,
                "friendId" : friendId
            },
            dataType:"json",
            success : function(data) {
                if(data==200){
                    alert("申请成功")
                }else if(data==201){
                    alert("您已经申请过了哦")
                }
            }
        });
    })
</script>